package com.adcc.swingui.demo.menubar;

import java.awt.Container;
import java.util.List;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;

import com.adcc.swingui.base.DefaultMenuBar;
import com.jidesoft.swing.JideMenu;
/**
 * 视图菜单
 * @author charlie
 *
 */
public class ViewMenuBut extends DefaultMenuBar {

	JMenuItem item;	
	JMenuItem tItem;
	JMenuItem chinaItem;
	JMenuItem worldItem;
	JMenuItem outItem;
	JMenuItem inItem;
	JMenuItem fullItem;
	JMenuItem sysItem;
	JMenuItem displayItem;
	
	JMenu menu;
	JMenu mMenu;
	JMenu mtMenu;
	
	JRadioButtonMenuItem mitItem;
	JRadioButtonMenuItem qItem;
	JRadioButtonMenuItem mItem;
	JRadioButtonMenuItem jItem;
	JRadioButtonMenuItem zItem;
	JRadioButtonMenuItem xzItem;
	JRadioButtonMenuItem lbtItem;
	JRadioButtonMenuItem nItem;
	JRadioButtonMenuItem sItem;
	
	ButtonGroup mMenuGroup;
	ButtonGroup mtMenuGroup;
	
	public ViewMenuBut(Container container) {
		super(container);
	}

	@Override
	protected JComponent build() {
		menu = new JideMenu("视图");
		menu.setMnemonic('V');
		
		//地图类型
		mMenu=new JMenu("地图类型");
		mMenuGroup = new ButtonGroup();
		mitItem= createRadioButtonMenuItem("frontierLine", "平面图", mMenuGroup);
		mitItem.setSelected(true);
		addChildMenu(mMenu, mitItem, mitItem.getName());
		tItem= createRadioButtonMenuItem("terra", "地形图", mMenuGroup);
		addChildMenu(mMenu, tItem, tItem.getName());
		addChildMenu(menu, mMenu, null);
		
		//地图投影
		mtMenu=new JMenu("地图投影");
		mtMenuGroup = new ButtonGroup();
		qItem = createRadioButtonMenuItem("roundProjection", "球形投影", mtMenuGroup);
		addChildMenu(mtMenu, qItem, qItem.getName());
		mItem = createRadioButtonMenuItem("maikatuo", "麦卡托", mtMenuGroup);
		addChildMenu(mtMenu, mItem, mItem.getName());
		jItem= createRadioButtonMenuItem("lonlat", "经纬度", mtMenuGroup);
		addChildMenu(mtMenu, jItem, jItem.getName());
		zItem= createRadioButtonMenuItem("sinusoidal", "正弦曲线", mtMenuGroup);
		addChildMenu(mtMenu, zItem, zItem.getName());
		xzItem= createRadioButtonMenuItem("modified", "修正正弦曲线", mtMenuGroup);
		addChildMenu(mtMenu, xzItem, xzItem.getName());
		lbtItem=createRadioButtonMenuItem("lambert", "兰伯特", mtMenuGroup);
		addChildMenu(mtMenu, lbtItem, lbtItem.getName());
		nItem= createRadioButtonMenuItem("northPolor", "北半球极射赤面", mtMenuGroup);
		addChildMenu(mtMenu, nItem, nItem.getName());
		sItem= createRadioButtonMenuItem("southPolor", "南半球极射赤面", mtMenuGroup);
		addChildMenu(mtMenu, sItem, sItem.getName());
		addChildMenu(menu, mtMenu, null);
		
		// 分割符
		menu.addSeparator();
		
		//定位中国
		chinaItem=new JMenuItem("定位中国",new ImageIcon("res/images/locate_china.png"));
		addChildMenu(menu, chinaItem, "setChinaLocation");
		
		//定位世界
		worldItem=new JMenuItem("定位世界",new ImageIcon("res/images/locate_world.png"));
		addChildMenu(menu, worldItem, "setWorldLocation");
		
		menu.addSeparator();
		
		//缩小
		outItem=new JMenuItem("缩小",new ImageIcon("res/images/zoom_out.png"));
		addChildMenu(menu, outItem, "zoomOut");
		
		//放大
		inItem=new JMenuItem("放大",new ImageIcon("res/images/zoom_in.png"));
		addChildMenu(menu, inItem, "zoomIn");
		
		//全屏地图
		fullItem=new JMenuItem("全屏地图",new ImageIcon("res/images/full_screem.png"));
		addChildMenu(menu, fullItem, "doFullScreen");
		
		//系统设置 Alt+Enter
		sysItem=new JMenuItem("系统设置",new ImageIcon("res/images/full_screem.png"));
		addChildMenu(menu, sysItem, "systemSet");
		
		//显示设置
		displayItem=new JMenuItem("显示设置",new ImageIcon("res/images/8.png"));
		addChildMenu(menu, displayItem, "displaySet");
		
		return menu;
	}
	/**
	 * 平面图
	 */
	public void frontierLine() {
		System.out.println("line");
	}
	/**
	 * 地形图
	 */
	public void terra() {
		System.out.println("terra");
	}
	
	/**
	 * 地图投影
	 */
	public void roundProjection() {
		System.out.println("round");
	}
	
	/**
	 * 麦卡托
	 */
	public void maikatuo() {
		System.out.println("maikatuo");
	}
	
	/**
	 * 经纬度
	 */
	public void lonlat() {
		System.out.println("lonlat");
	}
	
	/**
	 * 正弦曲线
	 */
	public void sinusoidal() {
		System.out.println("sin");
	}
	
	/**
	 * 修正正弦曲线
	 */
	public void modified() {
		System.out.println("modified");
	}
	
	
	/**
	 * 兰伯特
	 */
	public void lambert() {
		System.out.println("lambert");
	}
	
	/**
	 * 北半球极射赤面
	 */
	public void northPolor() {
		System.out.println("nor");
	}
	
	/**
	 * 南半球极射赤面
	 */
	public void southPolor() {
		System.out.println("sou");
	}
	
	/**
	 * 定位中国
	 */
	public void setChinaLocation() {
		System.out.println("set");
	}
	
	/**
	 * 定位世界
	 */
	public void setWorldLocation() {
		System.out.println("world");
	}
	
	/**
	 * 缩小
	 */
	public void zoomOut() {
		System.out.println("zoomout");
	}
	
	/**
	 * 放大
	 */
	public void zoomIn() {
		System.out.println("open");
	}
	
	/**
	 * 全屏地图
	 */
	public void doFullScreen() {
		System.out.println("full");
	}
	
	/**
	 * 系统设置
	 */
	public void SystemSet() {
		System.out.println("sys");
	}
	
	/**
	 * 显示设置
	 */
	public void displaySet() {
		System.out.println("dispaly");
	}

	@Override
	protected void offLineVisiable(List<JComponent> jcomps) {
		// TODO Auto-generated method stub
		
	}
	
}
